import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: 'Home',
    },
    {
      path: '/Home',
      name: 'Home',
      //一级页面
      component: () => import(/* webpackChunkName: "home" */ '../views/HomeView.vue')
    },
    {
      path: '/identify',
      name: 'identify',
      //二级页面
      component: () => import(/* webpackChunkName: "identify" */ '../views/IdentifyView.vue'),
      children:[{
        path: '/identify/about',
        name: 'about',
        component: () => import('@/views/identify/AboutView.vue'),
      },{
        path: '/identify/image',
        name: 'image',
        component: () => import('@/views/identify/ImageView.vue'),
      },{
        path: '/identify/means',
        name: 'means',
        component: () => import('@/views/identify/MeansView.vue'),
      },{
        path: '/identify/video',
        name: 'video',
        component: () => import('@/views/identify/VideoView.vue'),
      },{
        path: '/identify/class',
        name: 'class',
        component: () => import('@/views/identify/class.vue'),
      }]
    },
    {
      path: '/library',
      name: '纲目分类',
      //二级页面
      component: () => import(/* webpackChunkName: "library" */ '../views/LibraryView.vue'),
      children:[{
        path: '/library/:param1/:param2',
        name: '谷部',
        component: () => import('@/views/library/GuBu.vue'),
      }]
      // children: [{
      //   path: '/library/grass',
      //   name: '草部',
      //   component: () => import('@/views/library/CaoBu.vue'),
      //   children: [{
      //     path: '/library/mountain-grass',
      //     name: '山草',
      //     component: () => import('@/views/library/ShanCao.vue'),
      //   }]
      // },{
      //   path: '/library/:param1/:param2',
      //   name: '谷部',
      //   component: () => import('@/views/library/GuBu.vue'),
      // },{
      //   path: '/library/vegetable',
      //   name: '菜部',
      //   component: () => import('@/views/library/CaiBu.vue'),
      // },{
      //   path: '/library/fruit',
      //   name: '果部',
      //   component: () => import('@/views/library/GuoBu.vue'),
      // },{
      //   path: '/library/tree',
      //   name: '木部',
      //   component: () => import('@/views/library/MuBu.vue'),
      // }]
    },
    {
      path: '/forum',
      name: 'forum',
      //二级页面
      component: () => import(/* webpackChunkName: "forum" */ '../views/ForumView.vue'),
      children: [{
        path: '/forum',
        name: "所有文章",
        component: () => import('@/views/forum/ArticleList.vue'),
      }, {
        path: '/forum/:pBoardId',
        name: "一级板块",
        component: () => import('@/views/forum/ArticleList.vue'),
      }, {
        path: '/forum/:pBoardId/:boardId/',
        name: "二级板块",
        component: () => import('@/views/forum/ArticleList.vue'),
      }, {
        path: '/post/:articleId/',
        name: "文章详情",
        component: () => import('@/views/forum/ArticleDetail.vue'),
      }, {
        path: '/newPost',
        name: "发布文章",
        component: () => import('@/views/forum/EditPost.vue'),
      }, {
        path: '/editPost/:articleId',
        name: "编辑文章",
        component: () => import('@/views/forum/EditPost.vue'),
      }, {
        path: '/user/:userId',
        name: "用户信息",
        component: () => import('@/views/ucenter/Ucenter.vue'),
      }, {
        path: '/user/message/:type',
        name: "消息",
        component: () => import('@/views/ucenter/MessageList.vue'),
      }, {
        path: '/search',
        name: "搜索",
        component: () => import('@/views/Search.vue'),
      }]
    },
    {
      path: '/news',
      name: 'news',
      //二级页面
      component: () => import(/* webpackChunkName: "news" */ '../views/NewsView.vue'),
      children: [
        {
          path: '/news/detail',
          name: "新闻详情",
          component:()=>import('@/views/news/Add.vue')
        }
      ]
    },
    {
      path: '/news/add',
      name: "新闻详情1",
      component:()=>import('@/views/news/Add.vue')
    },
    {
      path: '/news/detail/:newsId',
      name: "新闻详情",
      component:()=>import('@/views/news/Show.vue')
    },
    {
      path: "/:pathMatch(.*)*",
      name: "错误页",
      component: () => import("@/views/Error404.vue")
    }
  ]
})

export default router
